Specify the tissue of interest, run the boilerplate code which sets up the functions and environment, load the tissue object.
tissue_of_interest = "Pancreas"
library(here)
here() starts at /Users/olgabot/code/tabula-muris
source(here("00_data_ingest", "02_tissue_analysis_rmd", "boilerplate.R"))
Loading required package: ggplot2
package ‘Seurat’ was built under R version 3.4.3Loading required package: cowplot
Attaching package: ‘cowplot’
The following object is masked from ‘package:ggplot2’:
ggsave
Loading required package: Matrix
package ‘dplyr’ was built under R version 3.4.2package ‘tidyverse’ was built under R version 3.4.2package ‘tidyr’ was built under R version 3.4.2package ‘purrr’ was built under R version 3.4.2
tiss = load_tissue_facs(tissue_of_interest)
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Scaling data matrix"
|
| | 0%
|
|=======================================================================================================================================| 100%
Calculating gene means
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variance to mean ratios
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Visualize top genes in principal components
Later on (in FindClusters and TSNE) you will pick a number of principal components to use. This has the effect of keeping the major directions of variation in the data and, ideally, supressing noise. There is no correct answer to the number to use, but a decent rule of thumb is to go until the plot plateaus.
PCElbowPlot(object = tiss)
Choose the number of principal components to use.
# Set number of principal components.
n.pcs = 12
The clustering is performed based on a nearest neighbors graph. Cells that have similar expression will be joined together. The Louvain algorithm looks for groups of cells with high modularity–more connections within the group than between groups. The resolution parameter determines the scale. Higher resolution will give more clusters, lower resolution will give fewer.
For the top-level clustering, aim to under-cluster instead of over-cluster. It will be easy to subset groups and further analyze them below.
# Set resolution
res.used <- 0.5
tiss <- FindClusters(object = tiss, reduction.type = "pca", dims.use = 1:n.pcs,
resolution = res.used, print.output = 0, save.SNN = TRUE)
We use TSNE solely to visualize the data.
# If cells are too spread out, you can raise the perplexity. If you have few cells, try a lower perplexity (but never less than 10).
tiss <- RunTSNE(object = tiss, dims.use = 1:n.pcs, seed.use = 10, perplexity=30)
TSNEPlot(object = tiss, do.label = T, pt.size = 1.2, label.size = 4)
Check expression of genes useful for indicating cell type. For the islet cells, the mRNA for their specific secretory molecule is a strong signal.
general endocrine: Chga, Isl1 alpha: Gcg, Mafb, Arx, beta: Ins1, Ins2, Mafa, Nkx6-1, Slc2a2, gamma: Ppy delta: Sst, Hhex epsilon: Ghrl ductal: Krt19, Hnf1b immune: Ptprc stellate: Pdgfra, Pdgfrb endothelial: Pecam1, Cdh5, Kdr acinar: Amy2b, Cpa1 other genes of interest: Cpa1, Ptf1a, Neurog3(endocrine progenitor and perhaps adult delta),Pdx1(beta and delta)
Dotplots let you see the intensity of expression and the fraction of cells expressing for each of your genes of interest. The radius shows you the percent of cells in that cluster with at least one read sequenced from that gene. The color level indicates the average Z-score of gene expression for cells in that cluster, where the scaling is done over all cells in the sample.
We can also find all differentially expressed genes marking each cluster. This may take some time.
#clust.markers0 <- FindMarkers(object = tiss, ident.1 = 0, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25)
#tiss.markers <- FindAllMarkers(object = tiss, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25)
Display the top markers you computed above.
#tiss.markers %>% group_by(cluster) %>% top_n(5, avg_logFC)
Using the markers above, we can confidentaly label many of the clusters:
0: beta 3: acinar 4: ductal 6: beta 7: endothelial 8: immune 9: stellate
The abundance of Ppy and Gcg in clusters 1 and 2 makes them seem like mixtures of alpha and gamma cells. The expression of Sst and Hhex in cluster 5 indicates that it might contain many delta cells, but to get a finer resolution, we subset the data and recompute.
We will add those cell_ontology_class to the dataset.
tiss <- StashIdent(object = tiss, save.name = "cluster.ids")
cluster.ids <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
free_annotation <- c(
"beta cell",
NA,
NA,
"acinar cell",
"ductal cell",
NA,
"beta cell",
"endothelial cell",
"immune cell",
"stellate cell")
cell_ontology_class <-c(
"type B pancreatic cell",
NA,
NA,
"pancreatic acinar cell",
"pancreatic ductal cell",
NA,
"type B pancreatic cell",
"endothelial cell",
"leukocyte",
"pancreatic stellate cell")
validate_cell_ontology(cell_ontology_class)
cell_ontology_id = convert_to_cell_ontology_id(cell_ontology_class)
tiss@meta.data['free_annotation'] <- as.character(plyr::mapvalues(x = tiss@ident, from = cluster.ids, to = free_annotation))
validate_cell_ontology(cell_ontology_class)
cell_ontology_id = convert_to_cell_ontology_id(cell_ontology_class)
tiss@meta.data['cell_ontology_class'] <- as.character(plyr::mapvalues(x = tiss@ident, from = cluster.ids, to = cell_ontology_class))
tiss@meta.data['cell_ontology_id'] <- as.character(plyr::mapvalues(x = tiss@ident, from = cluster.ids, to = cell_ontology_id))
Color by metadata, like plate barcode, to check for batch effects.
TSNEPlot(object = tiss, do.return = TRUE, group.by = "plate.barcode")
subtiss = SubsetData(tiss, ident.use = c(1,2,5))
subtiss <- subtiss %>% ScaleData() %>%
FindVariableGenes(do.plot = TRUE, x.high.cutoff = Inf, y.cutoff = 0.5) %>%
RunPCA(do.print = FALSE)
[1] "Scaling data matrix"
|
| | 0%
|
|=======================================================================================================================================| 100%
Calculating gene means
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variance to mean ratios
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
PCHeatmap(object = subtiss, pc.use = 1:3, cells.use = 500, do.balanced = TRUE, label.columns = FALSE, num.genes = 8)
PCElbowPlot(subtiss)
sub.n.pcs = 8
sub.res.use = 1
subtiss <- subtiss %>% FindClusters(reduction.type = "pca", dims.use = 1:sub.n.pcs,
resolution = sub.res.use, print.output = 0, save.SNN = TRUE) %>%
RunTSNE(dims.use = 1:sub.n.pcs, seed.use = 10, perplexity=30)
TSNEPlot(object = subtiss, do.label = T, pt.size = 1.2, label.size = 4)
All cells have the same value of Ptf1a.
VlnPlot(subtiss, 'Ppy')
table(subtiss@ident)
0 1 2 3 4 5 6 7
128 103 86 79 73 61 40 33
Discover new PP marker genes (negative or positive)
gamma_markers = FindMarkers(subtiss, ident.1 = c(6,7), ident.2 = c(0,1,2,4), test.use = "roc")
| | 0 % ~calculating
|+ | 1 % ~48s
|+ | 2 % ~52s
|++ | 3 % ~52s
|++ | 4 % ~51s
|+++ | 5 % ~52s
|+++ | 6 % ~51s
|++++ | 7 % ~50s
|++++ | 8 % ~50s
|+++++ | 9 % ~49s
|+++++ | 10% ~48s
|++++++ | 11% ~47s
|++++++ | 12% ~46s
|+++++++ | 13% ~46s
|+++++++ | 14% ~45s
|++++++++ | 15% ~45s
|++++++++ | 16% ~45s
|+++++++++ | 17% ~44s
|+++++++++ | 18% ~43s
|++++++++++ | 19% ~42s
|++++++++++ | 20% ~42s
|+++++++++++ | 21% ~41s
|+++++++++++ | 22% ~40s
|++++++++++++ | 23% ~40s
|++++++++++++ | 24% ~39s
|+++++++++++++ | 25% ~38s
|+++++++++++++ | 26% ~38s
|++++++++++++++ | 27% ~37s
|++++++++++++++ | 28% ~37s
|+++++++++++++++ | 29% ~36s
|+++++++++++++++ | 30% ~36s
|++++++++++++++++ | 31% ~35s
|++++++++++++++++ | 32% ~34s
|+++++++++++++++++ | 33% ~34s
|+++++++++++++++++ | 34% ~34s
|++++++++++++++++++ | 35% ~33s
|++++++++++++++++++ | 36% ~33s
|+++++++++++++++++++ | 37% ~32s
|+++++++++++++++++++ | 38% ~31s
|++++++++++++++++++++ | 39% ~31s
|++++++++++++++++++++ | 40% ~30s
|+++++++++++++++++++++ | 41% ~30s
|+++++++++++++++++++++ | 42% ~29s
|++++++++++++++++++++++ | 43% ~29s
|++++++++++++++++++++++ | 44% ~28s
|+++++++++++++++++++++++ | 45% ~28s
|+++++++++++++++++++++++ | 46% ~27s
|++++++++++++++++++++++++ | 47% ~27s
|++++++++++++++++++++++++ | 48% ~26s
|+++++++++++++++++++++++++ | 49% ~26s
|+++++++++++++++++++++++++ | 50% ~25s
|++++++++++++++++++++++++++ | 51% ~25s
|++++++++++++++++++++++++++ | 52% ~24s
|+++++++++++++++++++++++++++ | 53% ~24s
|+++++++++++++++++++++++++++ | 54% ~23s
|++++++++++++++++++++++++++++ | 55% ~23s
|++++++++++++++++++++++++++++ | 56% ~22s
|+++++++++++++++++++++++++++++ | 57% ~22s
|+++++++++++++++++++++++++++++ | 58% ~21s
|++++++++++++++++++++++++++++++ | 59% ~21s
|++++++++++++++++++++++++++++++ | 60% ~20s
|+++++++++++++++++++++++++++++++ | 61% ~20s
|+++++++++++++++++++++++++++++++ | 62% ~19s
|++++++++++++++++++++++++++++++++ | 63% ~19s
|++++++++++++++++++++++++++++++++ | 64% ~18s
|+++++++++++++++++++++++++++++++++ | 65% ~18s
|+++++++++++++++++++++++++++++++++ | 66% ~17s
|++++++++++++++++++++++++++++++++++ | 67% ~17s
|++++++++++++++++++++++++++++++++++ | 68% ~16s
|+++++++++++++++++++++++++++++++++++ | 69% ~16s
|+++++++++++++++++++++++++++++++++++ | 70% ~15s
|++++++++++++++++++++++++++++++++++++ | 71% ~15s
|++++++++++++++++++++++++++++++++++++ | 72% ~14s
|+++++++++++++++++++++++++++++++++++++ | 73% ~14s
|+++++++++++++++++++++++++++++++++++++ | 74% ~13s
|++++++++++++++++++++++++++++++++++++++ | 75% ~13s
|++++++++++++++++++++++++++++++++++++++ | 76% ~12s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~12s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~11s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~11s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~10s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~10s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~09s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~09s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~08s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~08s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~07s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~07s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~06s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~06s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~05s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~05s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~04s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~04s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~03s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~03s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~02s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~02s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 51s
gamma_markers = FindMarkers(subtiss, ident.1 = c(6,7), ident.2 = c(0,1,2,4), test.use = "wilcox")
| | 0 % ~calculating
|+ | 1 % ~01m 29s
|+ | 2 % ~01m 27s
|++ | 3 % ~01m 27s
|++ | 4 % ~01m 24s
|+++ | 5 % ~01m 23s
|+++ | 6 % ~01m 23s
|++++ | 7 % ~01m 22s
|++++ | 8 % ~01m 20s
|+++++ | 9 % ~01m 20s
|+++++ | 10% ~01m 20s
|++++++ | 11% ~01m 19s
|++++++ | 12% ~01m 18s
|+++++++ | 13% ~01m 17s
|+++++++ | 14% ~01m 16s
|++++++++ | 15% ~01m 15s
|++++++++ | 16% ~01m 14s
|+++++++++ | 17% ~01m 14s
|+++++++++ | 18% ~01m 13s
|++++++++++ | 19% ~01m 12s
|++++++++++ | 20% ~01m 12s
|+++++++++++ | 21% ~01m 11s
|+++++++++++ | 22% ~01m 10s
|++++++++++++ | 23% ~01m 09s
|++++++++++++ | 24% ~01m 08s
|+++++++++++++ | 25% ~01m 07s
|+++++++++++++ | 26% ~01m 06s
|++++++++++++++ | 27% ~01m 05s
|++++++++++++++ | 28% ~01m 04s
|+++++++++++++++ | 29% ~01m 03s
|+++++++++++++++ | 30% ~01m 03s
|++++++++++++++++ | 31% ~01m 02s
|++++++++++++++++ | 32% ~01m 01s
|+++++++++++++++++ | 33% ~01m 00s
|+++++++++++++++++ | 34% ~59s
|++++++++++++++++++ | 35% ~59s
|++++++++++++++++++ | 36% ~58s
|+++++++++++++++++++ | 37% ~57s
|+++++++++++++++++++ | 38% ~56s
|++++++++++++++++++++ | 39% ~55s
|++++++++++++++++++++ | 40% ~54s
|+++++++++++++++++++++ | 41% ~53s
|+++++++++++++++++++++ | 42% ~52s
|++++++++++++++++++++++ | 43% ~51s
|++++++++++++++++++++++ | 44% ~51s
|+++++++++++++++++++++++ | 45% ~50s
|+++++++++++++++++++++++ | 46% ~49s
|++++++++++++++++++++++++ | 47% ~48s
|++++++++++++++++++++++++ | 48% ~47s
|+++++++++++++++++++++++++ | 49% ~46s
|+++++++++++++++++++++++++ | 50% ~45s
|++++++++++++++++++++++++++ | 51% ~44s
|++++++++++++++++++++++++++ | 52% ~44s
|+++++++++++++++++++++++++++ | 53% ~43s
|+++++++++++++++++++++++++++ | 54% ~42s
|++++++++++++++++++++++++++++ | 55% ~41s
|++++++++++++++++++++++++++++ | 56% ~40s
|+++++++++++++++++++++++++++++ | 57% ~39s
|+++++++++++++++++++++++++++++ | 58% ~38s
|++++++++++++++++++++++++++++++ | 59% ~37s
|++++++++++++++++++++++++++++++ | 60% ~36s
|+++++++++++++++++++++++++++++++ | 61% ~35s
|+++++++++++++++++++++++++++++++ | 62% ~35s
|++++++++++++++++++++++++++++++++ | 63% ~34s
|++++++++++++++++++++++++++++++++ | 64% ~33s
|+++++++++++++++++++++++++++++++++ | 65% ~32s
|+++++++++++++++++++++++++++++++++ | 66% ~31s
|++++++++++++++++++++++++++++++++++ | 67% ~30s
|++++++++++++++++++++++++++++++++++ | 68% ~29s
|+++++++++++++++++++++++++++++++++++ | 69% ~28s
|+++++++++++++++++++++++++++++++++++ | 70% ~27s
|++++++++++++++++++++++++++++++++++++ | 71% ~26s
|++++++++++++++++++++++++++++++++++++ | 72% ~26s
|+++++++++++++++++++++++++++++++++++++ | 73% ~25s
|+++++++++++++++++++++++++++++++++++++ | 74% ~24s
|++++++++++++++++++++++++++++++++++++++ | 75% ~23s
|++++++++++++++++++++++++++++++++++++++ | 76% ~22s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~21s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~20s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~19s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~18s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~18s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~17s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~16s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~15s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~14s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~13s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~12s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~11s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~10s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~09s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~08s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~07s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~06s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~06s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~05s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~04s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~03s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~02s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 01m 32s
New markers from this test include 1) negative marker genes, aka. those abscent in PP cells or highly abundant in alpha cells ‘Arg1’, ‘Mafb’, ‘Gfra3’, ‘Slc38a5’, ‘Dpp10’,‘Ang’,‘Irx1’, 2) positive marker genes, aka. those abscent in alpha cells or highly abundant in PP cells ‘Cd9’, ‘Spp1’, ‘Tspan8’, ‘Folr1’,‘Vsig1’
gamma_genes_to_check_neg = c('Arg1', 'Mafb', 'Gfra3', 'Slc38a5', 'Dpp10','Ang','Irx1')
gamma_genes_to_check_pos = c('Cd9', 'Spp1', 'Tspan8', 'Folr1','Vsig1')
DotPlot(subtiss, gamma_genes_to_check_neg, col.max = 2.5, plot.legend = T, do.return = T) + coord_flip()
DotPlot(subtiss, gamma_genes_to_check_pos, col.max = 2.5, plot.legend = T, do.return = T) + coord_flip()
From these genes, it appears that the clusters represent:
0: alpha 1: alpha 2: alpha 3: delta 4: alpha 5: delta 6: gamma 7: gamma
The multitude of clusters of each type correspond mostly to individual animals/sexes.
table(FetchData(subtiss, c('mouse.id','ident')) %>% droplevels())
ident
mouse.id 0 1 2 3 4 5 6 7
3_10_M 113 8 1 29 0 12 10 1
3_38_F 4 14 82 4 0 21 0 11
3_39_F 2 80 3 2 0 19 0 21
3_8_M 9 1 0 44 73 9 30 0
sub.cluster.ids <- c(0, 1, 2, 3, 4, 5, 6, 7)
sub.free_annotation <- c("pancreatic A cell", "pancreatic A cell", "pancreatic A cell", "pancreatic D cell", "pancreatic A cell", "pancreatic D cell", "pancreatic PP cell", "pancreatic PP cell")
sub.cell_ontology_class <-c("pancreatic A cell", "pancreatic A cell", "pancreatic A cell", "pancreatic D cell", "pancreatic A cell", "pancreatic D cell", "pancreatic PP cell", "pancreatic PP cell")
validate_cell_ontology(sub.cell_ontology_class)
sub.cell_ontology_id = convert_to_cell_ontology_id(sub.cell_ontology_class)
subtiss@meta.data['free_annotation'] <- as.character(plyr::mapvalues(x = subtiss@ident, from = sub.cluster.ids, to = sub.free_annotation))
validate_cell_ontology(sub.cell_ontology_class)
sub.cell_ontology_id = convert_to_cell_ontology_id(sub.cell_ontology_class)
subtiss@meta.data['free_annotation'] <- as.character(plyr::mapvalues(x = subtiss@ident, from = sub.cluster.ids, to = sub.free_annotation))
subtiss@meta.data['cell_ontology_class'] <- as.character(plyr::mapvalues(x = subtiss@ident, from = sub.cluster.ids, to = sub.cell_ontology_class))
subtiss@meta.data['cell_ontology_id'] <- as.character(plyr::mapvalues(x = subtiss@ident, from = sub.cluster.ids, to = sub.cell_ontology_id))
sub.cells = rownames(subtiss@meta.data)
tiss@meta.data[sub.cells, 'free_annotation'] = subtiss@meta.data[,'free_annotation']
tiss@meta.data[sub.cells, 'cell_ontology_class'] = subtiss@meta.data[,'cell_ontology_class']
tiss@meta.data[sub.cells, 'cell_ontology_id'] = subtiss@meta.data[,'cell_ontology_id']
Color by metadata, like plate barcode, to check for batch effects.
TSNEPlot(object = tiss, do.return = TRUE, group.by = "plate.barcode")
Color by cell ontology class on the original TSNE.
TSNEPlot(object = tiss, do.return = TRUE, group.by = "cell_ontology_class")
table(tiss@meta.data[["cell_ontology_class"]])
endothelial cell leukocyte pancreatic A cell pancreatic acinar cell pancreatic D cell
66 54 390 182 140
pancreatic ductal cell pancreatic PP cell pancreatic stellate cell type B pancreatic cell
161 73 49 449
filename = here('00_data_ingest', '04_tissue_robj_generated',
paste0("facs_", tissue_of_interest, "_seurat_tiss.Robj"))
print(filename)
[1] "/Users/olgabot/code/tabula-muris/00_data_ingest/04_tissue_robj_generated/facs_Pancreas_seurat_tiss.Robj"
save(tiss, file=filename)
# To reload a saved object
# filename = here('00_data_ingest', '04_tissue_robj_generated',
# paste0("facs_", tissue_of_interest, "_seurat_tiss.Robj"))
# load(file=filename)
tiss@meta.data[, 'Neurog3>0_scaled'] = tiss@scale.data['Neurog3', ] > 0
tiss@meta.data[, 'Neurog3>0_raw'] = tiss@raw.data['Neurog3', colnames(tiss@scale.data)] > 0
Error in `[<-.data.frame`(`*tmp*`, , "Neurog3>0_raw", value = c(FALSE, :
replacement has 1 row, data has 1564
So that Biohub can easily combine all your cell_ontology_class, please export them as a simple csv.
head(tiss@meta.data)
filename = here('00_data_ingest', '03_tissue_annotation_csv',
paste0(tissue_of_interest, "_annotation.csv"))
write.csv(FetchData(tiss, c('plate.barcode','cell_ontology_class','cell_ontology_id', 'free_annotation', 'tSNE_1', 'tSNE_2')), file=filename)
FetchData(subtiss, c('Ppy', 'Gcg', 'Arx', 'Irx2', 'Mafb', 'mouse.id', 'plate.barcode', 'ident')) %>%
ggplot(aes(x = Ppy, y = Gcg, color = plate.barcode)) + geom_point()
# It would be interesting to fetch the ids of these cells expressing high Gcg as well as Ppy, and examine their genetic signature.
gammatiss <- RunPCA(subtiss, pc.genes = c('Arg1', 'Mafb', 'Gfra3', 'Slc38a5', 'Dpp10','Ang','Irx1', 'Cd9', 'Spp1', 'Tspan8', 'Folr1','Vsig1'), pcs.compute = 3)
PCHeatmap(object = gammatiss, pc.use = 1:3, cells.use = 500, do.balanced = TRUE, label.columns = FALSE, num.genes = 8)
GenePlot(subtiss, 'Vsig1', 'Gfra3')
Write the cell ontology and free annotations to CSV.
save_annotation_csv(tiss, tissue_of_interest, "facs", additional_cols = additional_cols)
Error in FetchData(tiss, columns) : Error: Neurog3>0_raw not found